#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
unordered_map<string, int> h;
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int k;
        cin >> k;
        if(k == 1) {
            string s;
            int score;
            cin >> s >> score;
            h[s] = score;
            cout << "OK" << endl;
        }else if(k == 2) {
            string s;
            cin >> s;
            if(h.find(s) == h.end()) {
                cout << "Not found" << endl;
            }else {
                cout << h[s] << endl;
            }
        }else if(k == 3) {
            string s;
            cin >> s;
            if(h.find(s) == h.end()) {
                cout << "Not found" << endl;
            }else {
                h.erase(s);
                cout << "Deleted successfully" << endl;
            }
        }else {
            cout << h.size() << endl;
        }
    }
    return 0;
}